package edu.gdkm.demo7;
public class Circle {
	public static void compute(String str) throws RadiusException {
		try{	
			int r=Integer.parseInt(str);
			if(r<0){
				throw new RadiusException();
			}
			System.out.println("圆的面积是："+Math.PI*r*r);
		}catch(NumberFormatException e){
			System.out.println("请输入数字！");
		}
	}
	//内部类
	static class RadiusException extends Exception{
		@Override
		public String getMessage() {
			return "圆的半径不能小于0";
		}
		public String e_message(){
			return "e_message：圆的半径不能小于0";
		}
	}
}
